<template>
	<view class="shenqingfapiao" style="padding-bottom: 128rpx;">
		<view class="shenqingfapiao-main">
			<view class="shenqingfapiao-box">
				<view class="fapiaoTop" v-if="tag == 3">
					<image src="@/static/img/wodefapiao/bohui.png" mode="" style="margin-left: 40rpx;"></image>
					<view style="flex: 1; margin-right: 30rpx;">驳回理由：<text v-html="reason"></text></view>
				</view>
				<view class="fapiaoTop" v-if="tag == 1">
					<image src="@/static/img/wodefapiao/shenqing.png" mode=""></image>
					<view>申请时间：{{time.replace(/T.+/, "")}}</view>
				</view>
				<view style="border-top: 1px solid #EAEAEA;width: 94%;margin: 0 auto;">
				</view>
			</view>
			<view class="shenqingfapiao-box">
				<view class="fapiaoTypeBox">
					<text class="fapiao_type_left">发票类型</text>
					<view class="fapiao_type_right">{{fptype}}</view>
				</view>
				<view class="shenqingfapiao-top">
					<text class="shenqingfapiao-top_left">开票信息</text>
				</view>
				<view class="shenqingfapiao-kpxx">
					<view class="kpxx-list">
						<view class="kpxx-list-top">{{fpdanwei}}</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">税号：</text>
							<text class="kpxx-cell-right">{{fpshuihao == '' ? '--' : fpshuihao }}</text>
						</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">邮箱：</text>
							<text class="kpxx-cell-right">{{email}}</text>
						</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">类型：</text>
							<text class="kpxx-cell-right">{{taitoulx == 1 ? "个人" : "企业"}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="shenqingfapiao-box">
				<view class="shenqingfapiao-top">
					<text class="shenqingfapiao-top_left">开票订单</text>
				</view>
				<view class="shenqingfapiao-kpxx" v-for="(item,index) in kaidingOrder">
					<view class="kpxx-list">
						<view class="kpxx-list-top">{{item.orderBianhao}}</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">业务名称：</text>
							<text class="kpxx-cell-right">{{item.orderdsc}}</text>
						</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">是否对公：</text>
							<text class="kpxx-cell-right">{{taitoulx == 1 ? "否" : "是"}}</text>
						</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">订单金额：</text>
							<text class="kpxx-cell-right">￥{{item.orderjine}}</text>
						</view>
						<view class="kpxx-list-cell">
							<text class="kpxx-cell-left">订单时间：</text>
							<text class="kpxx-cell-right">{{item.ordertime.replace(/T.+/, "")}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="shenqingfapiao-jiage">
				<view class="dingdan">发票订单</view>
				<view class="jiage">￥{{jine}}</view>
			</view>

		</view>
		<view class="shenqingfapiao-edit" v-if="tag == 3">
			<view class="shenqingfapiao-foot-edit" @click="editFapiao()">重新编辑</view>
		</view>
	</view>
</template>

<script>
	import commonjs from '@/common/script/common.js';
	export default {
		data() {
			return {
				isActive: '-1',
				fapiaoid: "",
				location: 11042,
				fptype: "",
				fpdanwei: "",
				fpshuihao: "",
				email: "",
				taitoulx: "", // 1：个人；2：企业
				jine: "",
				kaidingOrder: [],
				time: "",
				tag: "",
				// id: "",
				reason:''
			}
		},

		async onLoad(options) {
			this.fapiaoid = options.fapiaoid;
			this.tag = options.tag;
			await this.fapiaoDetail();
		},

		onShow() {

		},

		methods: {
			clickFplx(e) {
				this.isActive = e
			},

			// 查看发票 
			fapiaoDetail() {
				uni.$u.http
					.post('wechat/fapiao/FaPiaoDetailsHandler.ashx', {
						location: this.location,
						fpid: this.fapiaoid, 
					}).then((rs) => {
						this.fptype = rs.fptype;
						this.fpdanwei = rs.fpdanwei;
						this.fpshuihao = rs.fpshuihao;
						this.email = rs.email;
						this.taitoulx = rs.taitoulx;
						this.jine = rs.jine;
						this.time = rs.time;
						// this.id = rs.id;
						this.reason = rs.reason

						this.kaidingOrder = rs.orderList;
					})
			},
			
			editFapiao(){
				uni.navigateTo({
					url: '/pages/user/wodefapiao/shenqingfapiao?fapiaoid=' + this.fapiaoid
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "@/static/css/fapiao.scss";
	page,
	.shenqingfapiao {
		//height: 100%;
		background-color: #f4f4f4;
	}
</style>